package com.hzya.frame.hr.company.service.impl; 
import com.hzya.frame.system.user.entity.UserEntity;
import com.hzya.frame.utils.core.action.SessionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hzya.frame.hr.company.entity.CompanyEntity;
import com.hzya.frame.hr.company.service.ICompanyService;
import com.hzya.frame.hr.company.dao.ICompanyDao;
import com.hzya.frame.utils.core.service.BaseService;

import java.util.List;

/**
 * @description: 企业管理  service
 * @tableName:   hr_company 
 * @entityName:  CompanyEntity
 * @author: 	 gjh
 * @history:	 1.0
 */
@Service(value="hr_companyService")
public class  CompanyServiceImpl extends BaseService< CompanyEntity,Long> implements ICompanyService{
	
	protected ICompanyDao  companyDao;
	
	@Autowired
	public void setCompanyDao(ICompanyDao dao) {

		this.companyDao = dao;
		this.dao=dao;
	}

	/**
	 * 根据当前登陆人获取当人登陆人所在的公司，以及子公司
	 *
	 * @param entity
	 * @return
	 */
	@Override
	public List<CompanyEntity> listGetCompanyEntityToUser(CompanyEntity entity) {
		UserEntity user = SessionContext.getCurrentUser();
		entity.setUp_id(user.getCompany_org_id());
		return companyDao.query(entity);
	}
}
